package com.example.administrator.chinafood;

import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

/**
 * Created by Administrator on 2017/11/7.
 */

public class flPerson extends Fragment implements View.OnClickListener{
    private Context context;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable final ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fl_person,container,false);
        context = view.getContext();
        Button btn_myfood = (Button)view.findViewById(R.id.person_rb_1);
        Button btn_addfood = (Button)view.findViewById(R.id.person_rb_2);
        Button btn_otherfood= (Button)view.findViewById(R.id.person_rb_3);
        Button btn_badfood = (Button)view.findViewById(R.id.person_rb_4);
        Button btn_lifefood = (Button)view.findViewById(R.id.person_rb_5);

        btn_myfood.setOnClickListener(this);
        btn_addfood.setOnClickListener(this);
        btn_otherfood.setOnClickListener(this);
        btn_badfood.setOnClickListener(this);
        btn_lifefood.setOnClickListener(this);
        return view;
    }

    public void onClick(View v) {
        switch (v.getId()){
            case R.id.person_rb_1:
                startActivity(new Intent(context,PersonRbMyFood.class));
                break;
            case R.id.person_rb_2:
                startActivity(new Intent(context,PersonRbAddFood.class));
                break;
            case R.id.person_rb_3:
                startActivity(new Intent(context,PersonRbCollect.class));
                break;
            case R.id.person_rb_4:
                startActivity(new Intent(context,PersonRbBad.class));
                break;
            case R.id.person_rb_5:
                startActivity(new Intent(context,PersonRbLife.class));
                break;
        }
    }
}
